
#pragma once

template<class T>
class Triangle
{
public:
	T p1,p2,p3;
	Triangle() {}
	~Triangle() {}
	Triangle(const T &_p1, const T &_p2, const T &_p3) : p1(_p1), p2(_p2), p3(_p3) {}

	Triangle transform(const std::function<T(const T&)> &transformF) const
	{
		return Triangle(transformF(p1), transformF(p2), transformF(p3));
	}
	static void transformTriangles(std::vector<Triangle> &output_triangles, const std::vector<Triangle> &input_triangles, const std::function<T(const T&)>& transformF)
	{
		for (unsigned int i = 0; i < input_triangles.size(); i++)
			output_triangles.push_back(input_triangles[i].transform(transformF));
	}

	friend std::ostream& operator<< (std::ostream &out, Triangle &tri)
	{
		out << tri.p1 << " " << tri.p2 << " " << tri.p3;
		return out;
	}
}; 